home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 …ember: Reference Library / Dev.CD Dec 00 RL Disk 1.toast / pc / technical documentation / develop / develop issue 26 / develop issue 26 code / som and listpart / listpart dr4 / source / debugtools.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-22  |  1.2 KB  |  28 lines

  1. #include <Stdio.h>
  2. #include "DebugTools.h"
  3.  
  4. char dbgstr[255];
  5.  
  6. #define nbmsk 0x0000000F
  7.  
  8. /*
  9. ** Définitions
  10. */
  11.  
  12. void dn(long param) {char s[255]; sprintf(s, "%ld", (param)); ds(s);}
  13. void du(char param) {char s[255]; sprintf(s, "%c", (param)); ds(s);}
  14. void dr(long param) {du(((char *)(param))[0]);du(((char *)(param))[1]);du(((char *)(param))[2]);du(((char *)(param))[3]);}
  15. void db(long param) {if (param) ds("true"); else ds("false");}
  16. void da(long param) {long l = (long)StripAddress((Ptr)param); dh(l>>24);dh(l>>16);dh(l>>8);dh(l);}
  17. void dhl(long param) {dh(param>>24);dh(param>>16);dh(param>>8);dh(param);}
  18. void dpm(long param, short len) {long ll = (len >256)?256:len; ds(";dm ");da(param);ds(" ");da(ll);ds("; g");dp();}
  19. void dd() {strcpy(dbgstr,"");}
  20. void dp() {c2pstr(dbgstr); DebugStr((ConstStr255Param)dbgstr); dd();}
  21. void ds(char *param) {if (strlen(dbgstr)+strlen(param) > 91) dp(); strcat(dbgstr, param);}
  22. void dc() {ds(", ");}
  23. void dh(long param){short i; char s[2];s[0]=(((i=(((param)>>4)&nbmsk))<10)?i+48:i+55);s[1]=(((i=((param)&nbmsk))<10)?i+48:i+55);s[2]=0;ds(s);}
  24.  
  25. void dpg() {ds(";g");dp();}
  26. void logon() {ds(";log 'lazarus long:debug.output'");dpg();}
  27. void logoff() {ds(";log");dpg();}
  28.